package LuoGu.入门.Work;

import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long n = s.nextInt();
        int k = s.nextInt();
        BigInteger ans = new BigInteger("0");
        BigInteger n1 = new BigInteger(String.valueOf(n)).subtract(new BigInteger("1"));
        ans = n1.add(n1.multiply(n1.subtract(new BigInteger("1"))).divide(new BigInteger("2")));
        System.out.print(ans);
    }
}
